package com.example.registration.service;

import com.example.registration.entity.RegistrationLimit;
import com.example.registration.mapper.RegistrationLimitMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RegistrationLimitService {

    @Autowired
    private RegistrationLimitMapper registrationLimitMapper;

    /**
     * 获取所有报名限制
     * @return 报名限制列表
     */
    public List<RegistrationLimit> getAllLimits() {
        return registrationLimitMapper.findAll();
    }

    /**
     * 添加报名限制
     * @param limit 限制实体
     * @return 是否添加成功
     */
    public boolean addLimit(RegistrationLimit limit) {
        return registrationLimitMapper.insert(limit) > 0;
    }

    /**
     * 删除报名限制
     * @param id 限制ID
     * @return 是否删除成功
     */
    public boolean deleteLimit(Long id) {
        return registrationLimitMapper.deleteById(id) > 0;
    }
} 